package com.firebird.app.kotlin.stock.ui.index_fragment.money

import android.view.View
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import butterknife.BindView
import com.androidkun.xtablayout.XTabLayout
import com.firebird.app.kotlin.stock.TabAdapter
import com.firebird.app.kotlin.stock.base.BaseFragment
import com.firebird.app.kotlin.stock.R
import com.firebird.app.kotlin.stock.TabAdapter
import com.firebird.app.kotlin.stock.base.BaseActivity
import com.firebird.app.kotlin.stock.base.BaseFragment
import com.firebird.app.kotlin.stock.base.BaseMvpFragment
import com.firebird.app.kotlin.stock.ui.index_fragment.money.fragment.FragmentDay
import com.firebird.app.kotlin.stock.ui.index_fragment.money.fragment.FragmentFree
import com.firebird.app.kotlin.stock.ui.index_fragment.money.fragment.FragmentMonth
import java.util.*


class MoneyFragment : BaseFragment() {
    @BindView(R.id.tab)
    var tab: XTabLayout? = null
    @BindView(R.id.viewpage)
    var viewpage: ViewPager? = null
    private var titleList: MutableList<String>? = null
    private var fragmentList: MutableList<Fragment>? = null
    override fun initView(view: View?) {
        titleList = ArrayList()
        titleList.add("免息配资")
        titleList.add("按日配资")
        titleList.add("按月配资")
        fragmentList = ArrayList<Fragment>()
        fragmentList.add(FragmentFree())
        fragmentList.add(FragmentDay())
        fragmentList.add(FragmentMonth())
        viewpage!!.adapter = TabAdapter(activity!!.supportFragmentManager, titleList, fragmentList)
        viewpage!!.offscreenPageLimit = 3
        tab!!.setupWithViewPager(viewpage)
        tab!!.getTabAt(0)!!.select()
        viewpage!!.currentItem = 0
    }

    override val layoutId: Int
        get() = R.layout.fragment_money
}